<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Vue计算属性</title>
    <script src="js/vue.js"></script>
</head>

<body>
    <div id="root">
        <input type="text" name="" id="" v-model:value="firstName" /> <br>
        <input type="text" name="" id="" v-model:value="lastName" /><br>
        <span>{{sum}}</span><br>
        <span>{{sum1}}</span>
    </div>
</body>
<script>
    new Vue({
        el: "#root",
        data() {
            return {
                firstName: "张",
                lastName: "三"
            }
        }
        ,
        computed: {
            sum: {
                get() {
                    return this.firstName + '-' + this.lastName;
                }
            },
            sum1() {
                return this.firstName + '-' + this.lastName;
            }
        }
    })
</script>

</html>